package com.dm.comm.utils;

import com.dm.comm.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@Slf4j
public class BaseExceptionHandler {

    @ExceptionHandler(value = RuntimeException.class)
    @ResponseBody
    public Result handleException(RuntimeException e) {
        log.error("出现错误！",e);
        //TODO 日志记录
        return Result.fail(e.getMessage());
    }

}
